<?php require_once('../Connections/locale.php'); ?>
<?php
$colname_codice_report = "1";
if (isset($_GET['id_report'])) {
  $colname_codice_report = (get_magic_quotes_gpc()) ? $_GET['id_report'] : addslashes($_GET['id_report']);
}
mysql_select_db($database_locale, $locale);
$query_codice_report = sprintf("SELECT id_report, codice FROM reports WHERE id_report = %s", $colname_codice_report);
$codice_report = mysql_query($query_codice_report, $locale) or die(mysql_error());
$row_codice_report = mysql_fetch_assoc($codice_report);
$totalRows_codice_report = mysql_num_rows($codice_report);

mysql_select_db($database_locale, $locale);
//$query_risultato_report = "SELECT * FROM abbonati";
$query_risultato_report = $row_codice_report['codice'];
$risultato_report = mysql_query($query_risultato_report, $locale) or die(mysql_error());
$row_risultato_report = mysql_fetch_assoc($risultato_report);
$totalRows_risultato_report = mysql_num_rows($risultato_report);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table border="1" id="datatable">
  <tr>
<?
	//$row = mysql_fetch_assoc($risultato_report);
	for($y = 0 ; $y < mysql_num_fields($risultato_report) ; $y++){
		echo "<TD><strong>" . mysql_field_name($risultato_report, $y) . "</strong></TD>";
	}
?>
  </tr>
  <?php do { ?>
  <tr>
 
  <?
	for($y = 0 ; $y < mysql_num_fields($risultato_report) ; $y++){

	    //$row_risultato_report[$y] = str_replace("\"", "&quot;", $row[mysql_field_name($risultato_report, $y)]);
	    echo "<TD>" . $row_risultato_report[mysql_field_name($risultato_report, $y)]. "</TD>";
		
	}
?>  
  
 
  </tr>
  <?php } while ($row_risultato_report = mysql_fetch_assoc($risultato_report)); ?>
</table>

<p><a href="salva_report.php?id_report=<?php echo $row_codice_report['id_report']; ?>">Salva in PDF</a> </p>
</body>
</html>
<?php
mysql_free_result($codice_report);

mysql_free_result($risultato_report);
?>
